Hands On: Create a New Report
In this example, you’ll create a simple report using the Report Designer Component. This will familiarize you with some of the basic steps in connecting to a data source and creating a report. The report you will be creating is a Sales by Customer and Region report based on a Microsoft Access database. We'll use the Report Gallery experts to help quickly create the report.
Step by step
1 | Open the Visual Basic 5.0/6.0 application, if it is not already running. | |
2 | Create a new Standard EXE project by either selecting one from the Visual Basic start up dialog or navigating to New Project under the File menu. | |
3 | Add the Report Designer by navigating to the Project menu, selecting Add Crystal Reports 7.0. The Report Gallery window will appear. | |
![]() |
||
4 | To select a generic report format, click on the Standard button. The Create Report Expert window will appear with a series of tabs. The This window allows you to select from either Project or Other data sources. Typically, you would use a project based data source. The Other option is provided if you need to use one of the native data drivers included with Seagate Crystal Reports. | |
![]() |
||
5 | You will be connecting to an existing Access ODBC data source so click on the Project button. The Select Data Source window will appear with ODBC radio button on by default. Select "Xtreme sample data" from the list of data sources. | |
![]() |
||
6 | For this example, you’ll connect to the ODBC data source using ADO. To see which options are available, in the Select Data Source window, click Advanced. The Advanced Options dialog will appear. Click OK to accept the default of connecting using ADO. | |
7 | Now that you’ve specified the data source and connection method, you’ll need to specify the tables to use. Click Next > on the Select Data Source window, the Select Recordset window will appear. You’ll be selecting a database table object of customer sales information from the available list of database objects. Select the "Customer" object from the object pull down list and click on the Finish button. | |
![]() |
||
You’ll return to the Create Report Expert window. Now that you’ve selected the database and the table for your report, you’ll need to specify the fields you want to include in the report. | ||
8 | Click on the Fields tab and select the "Customer Name" database field in the Database Fields text box. Click and drag the field into the Report Fields text box. Do the same for the "Last Year’s Sales", "City" and "Region" fields. | |
![]() |
||
9 | Click on the Sort tab and drag the "Region" and "City" fields into the Sort Fields text box. Select in ascending order if not already visible in the Order drop-down box. | |
![]() |
||
10 | Click on the Total tab. Because The "Last Years Sales" field is the only numeric field in the report, the expert automatically selected it for totaling . | |
![]() |
||
11 | Click on the TopN tab. The Expert automatically selects sum of "Last Year’s Sales" and Top 5. | |
12 | Click on the Graph tab and click on the Pie button in the Graph Gallery. Select the Regular pie with 3D visual effect and click on the Data tab. The Report Expert automatically creates the graph based on the sum of "Last Year’s Sales". | |
![]() |
||
13 | Click on the Style tab and make the report a little prettier by selecting the Executive, Trailing Break style. Click OK. The Report Expert will then present you with the option of adding a form with the Crystal Report Viewer control and setting this as the startup object. | |
![]() |
||
Click OK to accept the defaults. The Expert will finish formatting the report which will be displayed in the design window. | ||
14 | Click on the Start button on the Visual Basic toolbar or press F5 to run your project. After a few seconds, you will see a form displaying the finished report in the Crystal Report Viewer. The report should look similar to the one shown below. | |
![]() |
||
At this point, you may want to save this project for use in the next exercise. |
This exercise has shown the basic steps in creating a new report. Although you don’t always have to use the Report Experts, they make connecting to your data source and creating the initial report fast and easy. You can then alter the look and feel of the report using the Report Designer window. Common tasks like field formatting, adding text and modifying field positions, can be accomplished through dragging fields around or altering their properties. These can be set either through the Visual Basic object properties window or through the use of Visual Basic code.
For the latest information about this
product, please visit the web site at www.seagatesoftware.com/scrvbasic.
Copyright ⌐ 1998 Seagate Software Inc. All rights reserved. Click here for additional information.